package com.shop.shopEnum;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public enum PayEnum {

    ALIPAY("aliPayImpl", "AliPayImpl", "支付宝支付");

    PayEnum(String code, String type, String desc) {
        this.code = code;
        this.type = type;
        this.desc = desc;
    }

    public String code;

    public String type;

    public String desc;


    public static String selectImplByType(String type) {
        List<PayEnum> payEnums = Arrays.stream(values()).filter(k -> k.type.equals(type)).collect(Collectors.toList());
        if (payEnums.size() > 0) return payEnums.get(0).code;
        else return null;
    }

}
